package BinaryTree;

/*
* 判断对称二叉树
* 左左==右右, 左右==右左
* */
public class IsSymmetric101 {
    public boolean isSymmetric(TreeNode root) {
        return ismirror(root,root);
    }

    private boolean ismirror(TreeNode p, TreeNode q) {
        if(p==null && q==null){
            return true;
        }
        if(p==null || q==null || p.val!=q.val){
            return false;
        }
            return ismirror(p.left,q.right)&&ismirror(p.right,q.left);
    }
}
